package com.sxt.springcloud.opd.fallback;

import com.sxt.opd.vo.JiuzhenVo;
import com.sxt.springcloud.opd.JiuzhenClientService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class JiuzhenClientFallbackService implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new JiuzhenClientService(){

            @Override
            public DataGridView loadAllJiuzhen(JiuzhenVo jiuzhenVo) {
                return new DataGridView("服务降级，服务器忙，请稍后重试！调用查询所有就诊方法失败");
            }

            /**
             * 添加
             *
             * @param jiuzhenVo
             */
            @Override
            public ResultObj addJiuzhen(JiuzhenVo jiuzhenVo) {
                return ResultObj.SERVER_BUSY;
            }

            /**
             * 修改
             *
             * @param jiuzhenVo
             */
            @Override
            public ResultObj updateJiuzhen(JiuzhenVo jiuzhenVo) {
                return ResultObj.SERVER_BUSY;
            }

            /**
             * 删除
             *
             * @param id
             */
            @Override
            public ResultObj deleteJiuzhen(Integer id) {
                return ResultObj.SERVER_BUSY;
            }
        };
    }
}
